# Contributor: Marius Dransfeld <marius.dransfeld@googlemail.com>

pkgname=ffmpeg-mt-git
pkgver=20090610
pkgrel=1
pkgdesc="Complete and free Internet live audio and video broadcasting solution for Linux/Unix (Multithread build, git version)"
arch=('i686' 'x86_64')
url="http://ffmpeg.mplayerhq.hu/"
license=('GPL')
depends=('lame' 'sdl' 'libvorbis' 'faad2' 'faac' 'xvidcore' 'zlib' 'imlib2' 'x264-git' 'libtheora' 'speex' 'openjpeg')
makedepends=('git')
provides=("ffmpeg=`date +%Y%m%d`")
conflicts=('ffmpeg')
source=()
md5sums=()

_gitroot="git://gitorious.org/ffmpeg/ffmpeg-mt.git"
_gitname="ffmpeg-mt"

build() {
  cd ${srcdir}
  msg "Connecting to GIT server...."

  if [ -d ${srcdir}/$_gitname ] ; then
    cd $_gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $_gitroot
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  cd ${srcdir}/$_gitname
  rm -r libswscale
  git clone git://git.mplayerhq.hu/libswscale
 
 ./configure \
  --prefix=/usr \
  --enable-gpl \
  --enable-nonfree \
  --enable-postproc \
  --enable-shared \
  --enable-pthreads \
  --enable-x11grab \
  --enable-network \
  --enable-runtime-cpudetect \
  --enable-libmp3lame \
  --enable-libopenjpeg \
  --enable-swscale-alpha \
  --enable-libvorbis \
  --enable-libfaac \
  --enable-libfaad \
  --enable-libx264 \
  --enable-libxvid \
  --enable-libspeex \
  --enable-libtheora \
  --enable-libfaac \
  --enable-libfaac \
  --enable-zlib \
  --enable-bzlib \
  --enable-optimizations \
  --arch=`uname -m` \
  || return 1

  make || return 1
  make doc/ff{mpeg,play,server}.1 || return 1

  make DESTDIR="$pkgdir" install || return 1
  make DESTDIR="$pkgdir" install-man || return 1

}
